Imports System.Windows.Forms
Imports dao
 Imports System.Data
Imports DTO
Public Class LOPHOCBus
Inherits AbstractBus
 Public Sub New()
 End Sub
 Public Sub New(ByVal ConnectionString As KetNoiDto)
 ketnoi = ConnectionString
 End Sub
 #Region "Xử Lý" 
 Public Sub Them(ByVal Dto As LOPHOCDto)
 Dim Dao As New LOPHOCDao(ketnoi)
 Dao.Them(Dto)
 End Sub
 Public Sub Xoa( ByVal IDLOPHOC As System.Int32)
 Dim Dao As New LOPHOCDao(ketnoi)
 Dao.xoa(IDLOPHOC)
 End Sub
 Public Sub sua(ByVal Dto As LOPHOCDto)
 Dim Dao As New LOPHOCDao(ketnoi)
 Dao.sua(Dto)
 End Sub
 #End Region 
 Public Function LayBangTable() As DataTable
 Dim Dao As New LOPHOCDao(ketnoi)
 dao.laybang()
 Return Dao
 End Function
 Public Function LayBangTableIlist() As IList
 Dim Dao As New LOPHOCDao(ketnoi)
 Dim aList As New ArrayList 
 For i As Integer = 0 To Dao.Rows.Count - 1 
 Dim dtoLOPHOC As LOPHOCdto = LayBangDTo(i, Dao) 
 aList.Add(dtoLOPHOC)
 Next 
 Return aList 
 End Function
 Public Function LayBangTableSQL(ByVal sql As string) As DataTable
 Dim Dao As New  AbstractDao(sql,sql,ketnoi)
 Return Dao
 End Function
 Public Sub suaTENLOP( ByVal TENLOP as System.String, ByVal IDLOPHOC As System.Int32 )
 Dim dao As New LOPHOCDao(ketnoi)
 dao.suaTENLOP(TENLOP,IDLOPHOC)
 End Sub 
 Public Sub suaIDCAPHOC( ByVal IDCAPHOC as System.Int32, ByVal IDLOPHOC As System.Int32 )
 Dim dao As New LOPHOCDao(ketnoi)
 dao.suaIDCAPHOC(IDCAPHOC,IDLOPHOC)
 End Sub 
 Public Sub suaIDGIANGDAY( ByVal IDGIANGDAY as System.Int32, ByVal IDLOPHOC As System.Int32 )
 Dim dao As New LOPHOCDao(ketnoi)
 dao.suaIDGIANGDAY(IDGIANGDAY,IDLOPHOC)
 End Sub 
 Public Sub suaNGAYBATKHAIGIANG( ByVal NGAYBATKHAIGIANG as System.DateTime, ByVal IDLOPHOC As System.Int32 )
 Dim dao As New LOPHOCDao(ketnoi)
 dao.suaNGAYBATKHAIGIANG(NGAYBATKHAIGIANG,IDLOPHOC)
 End Sub 
 Public Sub suaNGHIGIUAKY( ByVal NGHIGIUAKY as System.DateTime, ByVal IDLOPHOC As System.Int32 )
 Dim dao As New LOPHOCDao(ketnoi)
 dao.suaNGHIGIUAKY(NGHIGIUAKY,IDLOPHOC)
 End Sub 
 Public Sub suaNGAYKETTHUC( ByVal NGAYKETTHUC as System.DateTime, ByVal IDLOPHOC As System.Int32 )
 Dim dao As New LOPHOCDao(ketnoi)
 dao.suaNGAYKETTHUC(NGAYKETTHUC,IDLOPHOC)
 End Sub 
 Public Sub suaSISO( ByVal SISO as System.Int32, ByVal IDLOPHOC As System.Int32 )
 Dim dao As New LOPHOCDao(ketnoi)
 dao.suaSISO(SISO,IDLOPHOC)
 End Sub 
 Public Sub suaLOAILOP( ByVal LOAILOP as System.Int32, ByVal IDLOPHOC As System.Int32 )
 Dim dao As New LOPHOCDao(ketnoi)
 dao.suaLOAILOP(LOAILOP,IDLOPHOC)
 End Sub 
 Public Sub suaTRANGTHAI( ByVal TRANGTHAI as System.Int32, ByVal IDLOPHOC As System.Int32 )
 Dim dao As New LOPHOCDao(ketnoi)
 dao.suaTRANGTHAI(TRANGTHAI,IDLOPHOC)
 End Sub 
 Public Sub suaGHICHU( ByVal GHICHU as System.String, ByVal IDLOPHOC As System.Int32 )
 Dim dao As New LOPHOCDao(ketnoi)
 dao.suaGHICHU(GHICHU,IDLOPHOC)
 End Sub 
 Public Function LayBangTable( ByVal IDLOPHOC As System.Int32) As DataTable
 Dim Dao As New LOPHOCDao(IDLOPHOC,ketnoi)
 Return Dao
 End Function
 Public Function LayBangTableIlist( ByVal IDLOPHOC As System.Int32) As IList
 Dim Dao As New LOPHOCDao(IDLOPHOC,ketnoi)
 Dim aList As New ArrayList 
 For i As Integer = 0 To Dao.Rows.Count - 1 
 Dim dtoLOPHOC As LOPHOCdto = LayBangDTo(i, Dao) 
 aList.Add(dtoLOPHOC)
 Next 
 Return aList 
 End Function
 Public Function LayBangTableTheoIDLOPHOC (ByVal IDLOPHOC As System.Int32) As DataTable
 Dim Dao As New LOPHOCDao(ketnoi)
 Dao.layBangTheoIDLOPHOC(IDLOPHOC)
 Return Dao
 End Function
 Public Function LayBangTableTheoIDLOPHOC (ByVal ARRAY1 As ArrayList) As DataTable
 Dim Dao As New LOPHOCDao(ketnoi)
 Dao.layBangTheoIDLOPHOC(ARRAY1)
 Return Dao
 End Function
 Public sub XOAbangTableTheoIDLOPHOC (ByVal IDLOPHOC As System.Int32) 
 Dim Dao As New LOPHOCDao(ketnoi)
 Dao.XOABangTheoIDLOPHOC(IDLOPHOC)
 End sub
 Public Function LayBangTableTheoTENLOP (ByVal TENLOP As System.String) As DataTable
 Dim Dao As New LOPHOCDao(ketnoi)
 Dao.layBangTheoTENLOP(TENLOP)
 Return Dao
 End Function
 Public Function LayBangTableTheoTENLOP_like (ByVal TENLOP As System.String ) As DataTable
 Dim Dao As New LOPHOCDao(ketnoi)
 Dao.layBangTheoTENLOP_like (TENLOP)
 Return Dao
 End Function
 Public Function LayBangTableTheoTENLOP (ByVal ARRAY1 As ArrayList) As DataTable
 Dim Dao As New LOPHOCDao(ketnoi)
 Dao.layBangTheoTENLOP(ARRAY1)
 Return Dao
 End Function
 Public sub XOAbangTableTheoTENLOP (ByVal TENLOP As System.String) 
 Dim Dao As New LOPHOCDao(ketnoi)
 Dao.XOABangTheoTENLOP(TENLOP)
 End sub
 Public Function LayBangTableTheoIDCAPHOC (ByVal IDCAPHOC As System.Int32) As DataTable
 Dim Dao As New LOPHOCDao(ketnoi)
 Dao.layBangTheoIDCAPHOC(IDCAPHOC)
 Return Dao
 End Function
 Public Function LayBangTableTheoIDCAPHOC (ByVal ARRAY1 As ArrayList) As DataTable
 Dim Dao As New LOPHOCDao(ketnoi)
 Dao.layBangTheoIDCAPHOC(ARRAY1)
 Return Dao
 End Function
 Public sub XOAbangTableTheoIDCAPHOC (ByVal IDCAPHOC As System.Int32) 
 Dim Dao As New LOPHOCDao(ketnoi)
 Dao.XOABangTheoIDCAPHOC(IDCAPHOC)
 End sub
 Public Function LayBangTableTheoIDGIANGDAY (ByVal IDGIANGDAY As System.Int32) As DataTable
 Dim Dao As New LOPHOCDao(ketnoi)
 Dao.layBangTheoIDGIANGDAY(IDGIANGDAY)
 Return Dao
 End Function
 Public Function LayBangTableTheoIDGIANGDAY (ByVal ARRAY1 As ArrayList) As DataTable
 Dim Dao As New LOPHOCDao(ketnoi)
 Dao.layBangTheoIDGIANGDAY(ARRAY1)
 Return Dao
 End Function
 Public sub XOAbangTableTheoIDGIANGDAY (ByVal IDGIANGDAY As System.Int32) 
 Dim Dao As New LOPHOCDao(ketnoi)
 Dao.XOABangTheoIDGIANGDAY(IDGIANGDAY)
 End sub
 Public Function LayBangTableTheoNGAYBATKHAIGIANG (ByVal NGAYBATKHAIGIANG As System.DateTime) As DataTable
 Dim Dao As New LOPHOCDao(ketnoi)
 Dao.layBangTheoNGAYBATKHAIGIANG(NGAYBATKHAIGIANG)
 Return Dao
 End Function
 Public Function LayBangTableTheoNGAYBATKHAIGIANG(ByVal NGAYBATKHAIGIANG1 As System.DateTime,ByVal NGAYBATKHAIGIANG2 As System.DateTime ) As DataTable
 Dim Dao As New LOPHOCDao(ketnoi)
 Dao.layBangTheoNGAYBATKHAIGIANG(NGAYBATKHAIGIANG1 ,NGAYBATKHAIGIANG2)
 Return Dao
 End Function
 Public Function LayBangTableTheoNGAYBATKHAIGIANG (ByVal ARRAY1 As ArrayList) As DataTable
 Dim Dao As New LOPHOCDao(ketnoi)
 Dao.layBangTheoNGAYBATKHAIGIANG(ARRAY1)
 Return Dao
 End Function
 Public sub XOAbangTableTheoNGAYBATKHAIGIANG (ByVal NGAYBATKHAIGIANG As System.DateTime) 
 Dim Dao As New LOPHOCDao(ketnoi)
 Dao.XOABangTheoNGAYBATKHAIGIANG(NGAYBATKHAIGIANG)
 End sub
 Public Function LayBangTableTheoNGHIGIUAKY (ByVal NGHIGIUAKY As System.DateTime) As DataTable
 Dim Dao As New LOPHOCDao(ketnoi)
 Dao.layBangTheoNGHIGIUAKY(NGHIGIUAKY)
 Return Dao
 End Function
 Public Function LayBangTableTheoNGHIGIUAKY(ByVal NGHIGIUAKY1 As System.DateTime,ByVal NGHIGIUAKY2 As System.DateTime ) As DataTable
 Dim Dao As New LOPHOCDao(ketnoi)
 Dao.layBangTheoNGHIGIUAKY(NGHIGIUAKY1 ,NGHIGIUAKY2)
 Return Dao
 End Function
 Public Function LayBangTableTheoNGHIGIUAKY (ByVal ARRAY1 As ArrayList) As DataTable
 Dim Dao As New LOPHOCDao(ketnoi)
 Dao.layBangTheoNGHIGIUAKY(ARRAY1)
 Return Dao
 End Function
 Public sub XOAbangTableTheoNGHIGIUAKY (ByVal NGHIGIUAKY As System.DateTime) 
 Dim Dao As New LOPHOCDao(ketnoi)
 Dao.XOABangTheoNGHIGIUAKY(NGHIGIUAKY)
 End sub
 Public Function LayBangTableTheoNGAYKETTHUC (ByVal NGAYKETTHUC As System.DateTime) As DataTable
 Dim Dao As New LOPHOCDao(ketnoi)
 Dao.layBangTheoNGAYKETTHUC(NGAYKETTHUC)
 Return Dao
 End Function
 Public Function LayBangTableTheoNGAYKETTHUC(ByVal NGAYKETTHUC1 As System.DateTime,ByVal NGAYKETTHUC2 As System.DateTime ) As DataTable
 Dim Dao As New LOPHOCDao(ketnoi)
 Dao.layBangTheoNGAYKETTHUC(NGAYKETTHUC1 ,NGAYKETTHUC2)
 Return Dao
 End Function
 Public Function LayBangTableTheoNGAYKETTHUC (ByVal ARRAY1 As ArrayList) As DataTable
 Dim Dao As New LOPHOCDao(ketnoi)
 Dao.layBangTheoNGAYKETTHUC(ARRAY1)
 Return Dao
 End Function
 Public sub XOAbangTableTheoNGAYKETTHUC (ByVal NGAYKETTHUC As System.DateTime) 
 Dim Dao As New LOPHOCDao(ketnoi)
 Dao.XOABangTheoNGAYKETTHUC(NGAYKETTHUC)
 End sub
 Public Function LayBangTableTheoSISO (ByVal SISO As System.Int32) As DataTable
 Dim Dao As New LOPHOCDao(ketnoi)
 Dao.layBangTheoSISO(SISO)
 Return Dao
 End Function
 Public Function LayBangTableTheoSISO (ByVal ARRAY1 As ArrayList) As DataTable
 Dim Dao As New LOPHOCDao(ketnoi)
 Dao.layBangTheoSISO(ARRAY1)
 Return Dao
 End Function
 Public sub XOAbangTableTheoSISO (ByVal SISO As System.Int32) 
 Dim Dao As New LOPHOCDao(ketnoi)
 Dao.XOABangTheoSISO(SISO)
 End sub
 Public Function LayBangTableTheoLOAILOP (ByVal LOAILOP As System.Int32) As DataTable
 Dim Dao As New LOPHOCDao(ketnoi)
 Dao.layBangTheoLOAILOP(LOAILOP)
 Return Dao
 End Function
 Public Function LayBangTableTheoLOAILOP (ByVal ARRAY1 As ArrayList) As DataTable
 Dim Dao As New LOPHOCDao(ketnoi)
 Dao.layBangTheoLOAILOP(ARRAY1)
 Return Dao
 End Function
 Public sub XOAbangTableTheoLOAILOP (ByVal LOAILOP As System.Int32) 
 Dim Dao As New LOPHOCDao(ketnoi)
 Dao.XOABangTheoLOAILOP(LOAILOP)
 End sub
 Public Function LayBangTableTheoTRANGTHAI (ByVal TRANGTHAI As System.Int32) As DataTable
 Dim Dao As New LOPHOCDao(ketnoi)
 Dao.layBangTheoTRANGTHAI(TRANGTHAI)
 Return Dao
 End Function
 Public Function LayBangTableTheoTRANGTHAI (ByVal ARRAY1 As ArrayList) As DataTable
 Dim Dao As New LOPHOCDao(ketnoi)
 Dao.layBangTheoTRANGTHAI(ARRAY1)
 Return Dao
 End Function
 Public sub XOAbangTableTheoTRANGTHAI (ByVal TRANGTHAI As System.Int32) 
 Dim Dao As New LOPHOCDao(ketnoi)
 Dao.XOABangTheoTRANGTHAI(TRANGTHAI)
 End sub
 Public Function LayBangTableTheoGHICHU (ByVal GHICHU As System.String) As DataTable
 Dim Dao As New LOPHOCDao(ketnoi)
 Dao.layBangTheoGHICHU(GHICHU)
 Return Dao
 End Function
 Public Function LayBangTableTheoGHICHU_like (ByVal GHICHU As System.String ) As DataTable
 Dim Dao As New LOPHOCDao(ketnoi)
 Dao.layBangTheoGHICHU_like (GHICHU)
 Return Dao
 End Function
 Public Function LayBangTableTheoGHICHU (ByVal ARRAY1 As ArrayList) As DataTable
 Dim Dao As New LOPHOCDao(ketnoi)
 Dao.layBangTheoGHICHU(ARRAY1)
 Return Dao
 End Function
 Public sub XOAbangTableTheoGHICHU (ByVal GHICHU As System.String) 
 Dim Dao As New LOPHOCDao(ketnoi)
 Dao.XOABangTheoGHICHU(GHICHU)
 End sub
 Public Function LayBangDTo( ByVal IDLOPHOC As System.Int32) As LOPHOCdto
 Dim Dao As New LOPHOCDao(IDLOPHOC, ketnoi)
 Dim dto As New LOPHOCdto
 If Dao.Rows.Count<= 0 then Return dto
 Try
 If IsDBNull(Dao.Rows(0)("IDLOPHOC")) = False Then
 Dto.IDLOPHOC = Dao.Rows(0)("IDLOPHOC")
 End if
Catch ex As Exception
End Try
 Try
 If IsDBNull(Dao.Rows(0)("LOPHOC.IDLOPHOC")) = False Then
 Dto.IDLOPHOC = Dao.Rows(0)("LOPHOC.IDLOPHOC")
 End if
Catch ex As Exception
End Try
 Try
 If IsDBNull(Dao.Rows(0)("TENLOP")) = False Then
 Dto.TENLOP = Dao.Rows(0)("TENLOP")
 End if
Catch ex As Exception
End Try
 Try
 If IsDBNull(Dao.Rows(0)("LOPHOC.TENLOP")) = False Then
 Dto.TENLOP = Dao.Rows(0)("LOPHOC.TENLOP")
 End if
Catch ex As Exception
End Try
 Try
 If IsDBNull(Dao.Rows(0)("IDCAPHOC")) = False Then
 Dto.IDCAPHOC = Dao.Rows(0)("IDCAPHOC")
 End if
Catch ex As Exception
End Try
 Try
 If IsDBNull(Dao.Rows(0)("LOPHOC.IDCAPHOC")) = False Then
 Dto.IDCAPHOC = Dao.Rows(0)("LOPHOC.IDCAPHOC")
 End if
Catch ex As Exception
End Try
 Try
 If IsDBNull(Dao.Rows(0)("IDGIANGDAY")) = False Then
 Dto.IDGIANGDAY = Dao.Rows(0)("IDGIANGDAY")
 End if
Catch ex As Exception
End Try
 Try
 If IsDBNull(Dao.Rows(0)("LOPHOC.IDGIANGDAY")) = False Then
 Dto.IDGIANGDAY = Dao.Rows(0)("LOPHOC.IDGIANGDAY")
 End if
Catch ex As Exception
End Try
 Try
 If IsDBNull(Dao.Rows(0)("NGAYBATKHAIGIANG")) = False Then
 Dto.NGAYBATKHAIGIANG = Dao.Rows(0)("NGAYBATKHAIGIANG")
 End if
Catch ex As Exception
End Try
 Try
 If IsDBNull(Dao.Rows(0)("LOPHOC.NGAYBATKHAIGIANG")) = False Then
 Dto.NGAYBATKHAIGIANG = Dao.Rows(0)("LOPHOC.NGAYBATKHAIGIANG")
 End if
Catch ex As Exception
End Try
 Try
 If IsDBNull(Dao.Rows(0)("NGHIGIUAKY")) = False Then
 Dto.NGHIGIUAKY = Dao.Rows(0)("NGHIGIUAKY")
 End if
Catch ex As Exception
End Try
 Try
 If IsDBNull(Dao.Rows(0)("LOPHOC.NGHIGIUAKY")) = False Then
 Dto.NGHIGIUAKY = Dao.Rows(0)("LOPHOC.NGHIGIUAKY")
 End if
Catch ex As Exception
End Try
 Try
 If IsDBNull(Dao.Rows(0)("NGAYKETTHUC")) = False Then
 Dto.NGAYKETTHUC = Dao.Rows(0)("NGAYKETTHUC")
 End if
Catch ex As Exception
End Try
 Try
 If IsDBNull(Dao.Rows(0)("LOPHOC.NGAYKETTHUC")) = False Then
 Dto.NGAYKETTHUC = Dao.Rows(0)("LOPHOC.NGAYKETTHUC")
 End if
Catch ex As Exception
End Try
 Try
 If IsDBNull(Dao.Rows(0)("SISO")) = False Then
 Dto.SISO = Dao.Rows(0)("SISO")
 End if
Catch ex As Exception
End Try
 Try
 If IsDBNull(Dao.Rows(0)("LOPHOC.SISO")) = False Then
 Dto.SISO = Dao.Rows(0)("LOPHOC.SISO")
 End if
Catch ex As Exception
End Try
 Try
 If IsDBNull(Dao.Rows(0)("LOAILOP")) = False Then
 Dto.LOAILOP = Dao.Rows(0)("LOAILOP")
 End if
Catch ex As Exception
End Try
 Try
 If IsDBNull(Dao.Rows(0)("LOPHOC.LOAILOP")) = False Then
 Dto.LOAILOP = Dao.Rows(0)("LOPHOC.LOAILOP")
 End if
Catch ex As Exception
End Try
 Try
 If IsDBNull(Dao.Rows(0)("TRANGTHAI")) = False Then
 Dto.TRANGTHAI = Dao.Rows(0)("TRANGTHAI")
 End if
Catch ex As Exception
End Try
 Try
 If IsDBNull(Dao.Rows(0)("LOPHOC.TRANGTHAI")) = False Then
 Dto.TRANGTHAI = Dao.Rows(0)("LOPHOC.TRANGTHAI")
 End if
Catch ex As Exception
End Try
 Try
 If IsDBNull(Dao.Rows(0)("GHICHU")) = False Then
 Dto.GHICHU = Dao.Rows(0)("GHICHU")
 End if
Catch ex As Exception
End Try
 Try
 If IsDBNull(Dao.Rows(0)("LOPHOC.GHICHU")) = False Then
 Dto.GHICHU = Dao.Rows(0)("LOPHOC.GHICHU")
 End if
Catch ex As Exception
End Try
 Return dto
 end function
 Public Function LayBangDTo(ByVal i As Integer, ByVal dao As DataTable) As LOPHOCdto
 Dim dto As New LOPHOCdto
 If Dao.Rows.Count<=0 then Return dto
 Try
 If IsDBNull(Dao.Rows(i)("IDLOPHOC")) = False Then
 Dto.IDLOPHOC = Dao.Rows(i)("IDLOPHOC")
 End if
 Catch ex As Exception
 End Try
 Try
 If IsDBNull(Dao.Rows(i)("LOPHOC.IDLOPHOC")) = False Then
 Dto.IDLOPHOC = Dao.Rows(i)("LOPHOC.IDLOPHOC")
 End if
 Catch ex As Exception
 End Try
 Try
 If IsDBNull(Dao.Rows(i)("TENLOP")) = False Then
 Dto.TENLOP = Dao.Rows(i)("TENLOP")
 End if
 Catch ex As Exception
 End Try
 Try
 If IsDBNull(Dao.Rows(i)("LOPHOC.TENLOP")) = False Then
 Dto.TENLOP = Dao.Rows(i)("LOPHOC.TENLOP")
 End if
 Catch ex As Exception
 End Try
 Try
 If IsDBNull(Dao.Rows(i)("IDCAPHOC")) = False Then
 Dto.IDCAPHOC = Dao.Rows(i)("IDCAPHOC")
 End if
 Catch ex As Exception
 End Try
 Try
 If IsDBNull(Dao.Rows(i)("LOPHOC.IDCAPHOC")) = False Then
 Dto.IDCAPHOC = Dao.Rows(i)("LOPHOC.IDCAPHOC")
 End if
 Catch ex As Exception
 End Try
 Try
 If IsDBNull(Dao.Rows(i)("IDGIANGDAY")) = False Then
 Dto.IDGIANGDAY = Dao.Rows(i)("IDGIANGDAY")
 End if
 Catch ex As Exception
 End Try
 Try
 If IsDBNull(Dao.Rows(i)("LOPHOC.IDGIANGDAY")) = False Then
 Dto.IDGIANGDAY = Dao.Rows(i)("LOPHOC.IDGIANGDAY")
 End if
 Catch ex As Exception
 End Try
 Try
 If IsDBNull(Dao.Rows(i)("NGAYBATKHAIGIANG")) = False Then
 Dto.NGAYBATKHAIGIANG = Dao.Rows(i)("NGAYBATKHAIGIANG")
 End if
 Catch ex As Exception
 End Try
 Try
 If IsDBNull(Dao.Rows(i)("LOPHOC.NGAYBATKHAIGIANG")) = False Then
 Dto.NGAYBATKHAIGIANG = Dao.Rows(i)("LOPHOC.NGAYBATKHAIGIANG")
 End if
 Catch ex As Exception
 End Try
 Try
 If IsDBNull(Dao.Rows(i)("NGHIGIUAKY")) = False Then
 Dto.NGHIGIUAKY = Dao.Rows(i)("NGHIGIUAKY")
 End if
 Catch ex As Exception
 End Try
 Try
 If IsDBNull(Dao.Rows(i)("LOPHOC.NGHIGIUAKY")) = False Then
 Dto.NGHIGIUAKY = Dao.Rows(i)("LOPHOC.NGHIGIUAKY")
 End if
 Catch ex As Exception
 End Try
 Try
 If IsDBNull(Dao.Rows(i)("NGAYKETTHUC")) = False Then
 Dto.NGAYKETTHUC = Dao.Rows(i)("NGAYKETTHUC")
 End if
 Catch ex As Exception
 End Try
 Try
 If IsDBNull(Dao.Rows(i)("LOPHOC.NGAYKETTHUC")) = False Then
 Dto.NGAYKETTHUC = Dao.Rows(i)("LOPHOC.NGAYKETTHUC")
 End if
 Catch ex As Exception
 End Try
 Try
 If IsDBNull(Dao.Rows(i)("SISO")) = False Then
 Dto.SISO = Dao.Rows(i)("SISO")
 End if
 Catch ex As Exception
 End Try
 Try
 If IsDBNull(Dao.Rows(i)("LOPHOC.SISO")) = False Then
 Dto.SISO = Dao.Rows(i)("LOPHOC.SISO")
 End if
 Catch ex As Exception
 End Try
 Try
 If IsDBNull(Dao.Rows(i)("LOAILOP")) = False Then
 Dto.LOAILOP = Dao.Rows(i)("LOAILOP")
 End if
 Catch ex As Exception
 End Try
 Try
 If IsDBNull(Dao.Rows(i)("LOPHOC.LOAILOP")) = False Then
 Dto.LOAILOP = Dao.Rows(i)("LOPHOC.LOAILOP")
 End if
 Catch ex As Exception
 End Try
 Try
 If IsDBNull(Dao.Rows(i)("TRANGTHAI")) = False Then
 Dto.TRANGTHAI = Dao.Rows(i)("TRANGTHAI")
 End if
 Catch ex As Exception
 End Try
 Try
 If IsDBNull(Dao.Rows(i)("LOPHOC.TRANGTHAI")) = False Then
 Dto.TRANGTHAI = Dao.Rows(i)("LOPHOC.TRANGTHAI")
 End if
 Catch ex As Exception
 End Try
 Try
 If IsDBNull(Dao.Rows(i)("GHICHU")) = False Then
 Dto.GHICHU = Dao.Rows(i)("GHICHU")
 End if
 Catch ex As Exception
 End Try
 Try
 If IsDBNull(Dao.Rows(i)("LOPHOC.GHICHU")) = False Then
 Dto.GHICHU = Dao.Rows(i)("LOPHOC.GHICHU")
 End if
 Catch ex As Exception
 End Try
 Return dto
 end function
 Public Function LayBangDTo(ByVal dong As Integer, ByVal dao As DataGridView) As LOPHOCdto
 Dim dto As New LOPHOCdto
 If dao.Rows.Count <= 0 Then Return dto
 For cot As Integer = 0 To dao.Columns.Count - 1
 Try
 Dto.HoTro(dao.Columns(cot).DataPropertyName, dao.Item(cot, dong).Value)
 Catch ex As Exception
 End Try
 Next
 Return Dto
 End Function
 Public Function layBangNhieuTable() as Datatable
 Dim Dao As New LOPHOCDao(ketnoi)
 Dao.layBangNhieuTable()
 Return Dao
 End Function
 Public Sub Taotable()
 Dim Dao As New LOPHOCDao(ketnoi)
 Dao.TaoTable()
 End Sub
 End Class

